//
//  NetworkEngine.swift
//  SwiftNetwork
//
//  Created by 万孟超 on 2022/1/11.
//

import UIKit

protocol NetowrkProgressProtocol {
    func network(request : NetworkBaseRequest, progress : Progress)
}

class NetworkEngine {
    let bindMethod : String
    var delegate : NetowrkProgressProtocol? = nil
    
    static var enginePointIndex = 0
    var enginePoint : String {
        get {
            return NSString.init(format: "%d", NetworkEngine.enginePointIndex) as String + bindMethod
        }
    }
    
    init(withBindMethod method : String) {
        NetworkEngine.enginePointIndex += 1
        bindMethod = method
    }
    
    func cancelNetwork() {
        NetworkClient.shared.cancelNetwork(forEnginePoint: enginePoint)
    }
}


